#include <iostream>

using namespace std;

void swap01(int a, int b) {
    int temp = a;
    a = b;
    b = temp;
}

void swap02(int *p1, int *p2) {
    int temp = *p1;
    *p1 = *p2;
    *p2 = temp;
}

int main() {
    // 值传递
    int a = 10, b = 20;
    cout << "a = " << a << ", b = " << b << endl;
    swap01(a, b);
    cout << "a = " << a << ", b = " << b << endl;

    // 地址传递
    swap02(&a, &b);
    cout << "a = " << a << ", b = " << b << endl;

    return 0;
}